package cn.javaweb.servlet;

import cn.javaweb.group0.model.ModuleModel;
import cn.javaweb.library.AjaxResult;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;

@WebServlet("/common/init")
public class CommonServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ModuleModel moduleModel = new ModuleModel();

        HashMap<String, Object> appInfo = new HashMap<String, Object>();

        appInfo.put("app_name", "课程管理系统");
        appInfo.put("version", "1.0.1");
        appInfo.put("entries", moduleModel.getModuleList(1,20));


        resp.getWriter().print(AjaxResult.success("OK", appInfo));

    }
}

